package com.cskaoyan.dbutils.rsh;

import com.cskaoyan.connectionpool.opensource.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import java.sql.SQLException;

/**
 * 创建日期: 2022/08/29 11:22
 *
 * @author ciggar
 */
public class ScalarHandlerDemo {

    public static void main(String[] args) throws SQLException {

        // 1. 构建QueryRUnner
        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        // 2. 执行SQL
        Long count = queryRunner.query("select count(*) from user", new ScalarHandler<>());


        System.out.println("count:" + count);

    }
}
